// Text thumbnail generator
package main

import (
	"fmt"
	"os"
	dutils "pkg.deepin.io/lib/utils"
	"strconv"
)

const (
	TextTypeText = "text/plain"
	TextTypeC    = "text/x-c"
	TextTypeCpp  = "text/x-cpp"
	TextTypeGo   = "text/x-go"
)

func main() {
	size, _ := strconv.ParseInt(os.Args[2], 10, 64)
	fmt.Println("Size:", size)
	dest, err := genTextThumbnail(os.Args[1], "", int(size), int(size))
	if err != nil {
		fmt.Println("Failed:", err)
		return
	}
	fmt.Println("Thumbnail:", dest)
}

func genTextThumbnail(src, bg string, width, height int) (string, error) {
	dest := fmt.Sprintf("/tmp/text-%d.png", width)
	return doGenThumbnail(dutils.DecodeURI(src), dest, width, height)
}
